﻿using Authorization.Center.Controllers;
using Authorization.Center.SqlServer;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.ReportForms.Domain.Dto;
using static S.ReportForms.Read.API.Application.Command.HomeProductionWarningAllCommand;

namespace S.ReportForms.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HomeProductionWarningController : BaseController
    {
        private readonly IMediator mediator;

        public HomeProductionWarningController(MySqlDbContext _db, IMediator mediator) : base(_db)
        {
            this.mediator = mediator;
        }



        /// <summary>
        /// 获取首页生产警告的数据
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Authorize]
        public async Task<List<HomeProductionWarningDto>> GetHomeProductionWarning()
        {
            return await mediator.Send(new HomeProductionWarningCommand());
        }
    }
}
